package com.yc.cloud.common.basic.dto;

import io.swagger.annotations.ApiModel;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.Max;
import lombok.Data;


@Data
@ApiModel
public class BasePageReqDTO {

    public static final Integer DEFAULT_SIZE = 10;
    public static final Integer DEFAULT_NUM = 1;

    public static final String ORDER_DESC = "desc";
    public static final String ORDER_ASC = "asc";
    public static final String DEFAULT_SORT_BY = "id";

    @Schema(description = "查询条件")
    private String keyword;

    @Schema(description = "第几页,默认1", example = "1")
    private Integer pageNum = DEFAULT_NUM;

    @Schema(description = "一页显示多少数量,默认10,最大不超过1000", example = "10")
    @Max(value = 1000)
    private Integer pageSize = DEFAULT_SIZE;

    @Schema(description = "按字段排序,默认按照ID降序",defaultValue = "id", example = "id")
    private String sortBy = DEFAULT_SORT_BY;

    @Schema(description = "降序或升序,默认降序",defaultValue = "desc", example = "desc")
    private String order = ORDER_DESC;

    @Schema(description = "是否分页,默认分页,0:不分页 1:分页", example = "1", hidden = true)
    private Boolean page = true;

}
